<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="container-div">
    <div class="btn-group hidden-xs" id="toolbar" role="group">
        <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()"
           shiro:hasPermission="beautyflower:member:add">
            <i class="fa fa-plus"></i> 新增
        </a>
        <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.removeAll()"
           shiro:hasPermission="beautyflower:member:remove">
            <i class="fa fa-trash-o"></i> 删除
        </a>
    </div>

    <div class="col-sm-12 select-table table-striped">
        <table id="bootstrap-table" data-mobile-responsive="true"></table>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('beautyflower:member:edit')}]];
    var removeFlag = [[${@permission.hasPermi('beautyflower:member:remove')}]];
    var detailsFlag = [[${@permission.hasPermi('beautyflower:member:details')}]];
    var sexDatas = [[${@dict.getType('member_sex_type')}]];
    var prefix = ctx + "beautyflower/member";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "用户管理",
            columns: [{
                checkbox: true
            },
                {
                    field: 'name',
                    title: '姓名'
                },
                {
                    field: 'firstLoginDate',
                    title: '首次登录时间'
                },
                {
                    field: 'latelyLoginDate',
                    title: '最近登录时间'
                },
                {
                    field: 'loginCount',
                    title: '登录次数'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a class="btn btn-info btn-xs ' + detailsFlag + '" href="#" onclick="details(\'' + row.id + '\')" style="margin-left: 4px"><i class="fa fa-eye"></i>详情</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    /*用户管理-详情*/
    function details(userId) {
        var url = prefix + '/details/' + userId;
        $.modal.openFill("用户详情", url);
    }
</script>
</body>
</html>